home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / LOGO / 3530.ZIP / LOGO.ZIP / INSTRUCT.DOC next >
Encoding:
Text File  |  1992-07-10  |  14.1 KB  |  378 lines

  1.                              Logo Instructions.
  2.  
  3.          Logo is a language developed for school children by
  4.          Seymour Papert. It encourages them to interact more
  5.          eagerly and more easily with the computer.
  6.  
  7.          The Logo language consists of two parts: there is the list
  8.          handling section and the far more widely used Turtle
  9.          Graphics section. It is the Turtle Graphics which you have
  10.          here.
  11.  
  12.          Turtle Graphics will allow you to create a variety of
  13.          different patterns on the screen as well as introduce you
  14.          to good programming practice.
  15.  
  16.          In addition it will allow you to create an almost
  17.          "intelligent" Turtle as well as use the Turtle to plot
  18.          graphs.
  19.  
  20.          Logo is considered such an important language in allowing
  21.          children to build up confidence in the computer that it is
  22.          quoted in several places in the National Curriculum ,
  23.          Mathematics document. The version which you have purchased
  24.          will allow you to do develop all the Logo ideas described
  25.          in that document.
  26.  
  27.          Getting Started:
  28.  
  29.          Insert the disc in the logged disc drive, type LOGO and
  30.          press return. The disc must have Logo.exe and Logo.dat in
  31.          the same directory. All your files will also be stored in
  32.          this directory.
  33.  
  34.          Now that you are into Logo you have the ? prompt. This is
  35.          to remind you that you are now in charge of the Turtle-
  36.          that is the little triangle in the middle of the screen.
  37.          That is its Home and when you type Home that is where it
  38.          will go.
  39.  
  40.          Now enter a command such as FORWARD 100 or FD 100 for
  41.          short, and press return. This tells the Turtle to move
  42.          forward by 100 steps. Commands can be in UPPER or lower
  43.          case. All commands should have a space after them.
  44.  
  45.  
  46.          We can make it turn right by 90 degrees with RIGHT 90 or RT
  47.          90. LEFT 27 or LT 27 will turn it 27 degrees to the left.
  48.  
  49.          Sometimes we don't want the Turtle to be visible. When
  50.          invisible it does draw faster. We can hide the Turtle with
  51.          HT and make it show again with ST.
  52.  
  53.          By now you know enough Logo to draw some simple patterns.
  54.          Draw some. If you make a small mistake use PE to turn the
  55.          Turtle pen into an eraser to rub out the line and then
  56.          SETPC 15 to change it back into a pen that draws.
  57.  
  58.          If you make a terrible mess of the screen then type CLEAN
  59.          to clean the screen. If you want to move the Turtle to a
  60.          new spot on the screen without it drawing then use PU for
  61.          pen up then use PD when you want it to draw again.
  62.  
  63.          The screen you are working on measures 2000 units by 2000
  64.          units. The centre of the screen has co-ordinates 0,0.
  65.  
  66.          You can use SETX -123 to put the Turtle at position X=-123
  67.          and SETY -234 to put it at position Y=-234. You can also
  68.          use SETPOS -123 -234 to place the Turtle at the same
  69.          position. To find out where you are on the screen type:
  70.          PR POS
  71.  
  72.          The Turtle cannot leave the screen  unless you give it
  73.          permission. It sees a fence right round the screen. If you
  74.          try and go FORWARD 3000 then it will say "That is over the
  75.          fence."
  76.  
  77.          To allow the Turtle to escape you can use the command
  78.          WRAP. This allows the Turtle to disappear of one side of
  79.          the screen and immediately reappear on the opposite side
  80.          of the screen. It is as if the screen were a sphere.
  81.  
  82.          The other method of letting the Turtle leave the screen is
  83.          to give it the command WINDOW. This allows the Turtle to
  84.          go anywhere but you can only see it when it appears in
  85.          front of the window which is the screen.
  86.  
  87.          Now we can draw simple patterns. To draw a square you need
  88.          the following commands:
  89.          CS
  90.          FD 200
  91.          RT 90
  92.          FD 200
  93.          RT 90
  94.          FD 200
  95.          RT 90
  96.          FD 200
  97.          RT 90
  98.          which is very slow to type every time you want a square.
  99.  
  100.          Instead we can reduce that to:
  101.          CS
  102.          REP 4[FD 200 RT 90]
  103.          This is short for repeat four times the section in square
  104.          brackets. This will produce a square.
  105.  
  106.          We can have brackets inside brackets. For example try:
  107.          CS
  108.          REP 4[FD 200 RT 90 REP 4[FD 80 LT 90]]
  109.          Even that can be bit of a handful if we have to type it
  110.          regularly so instead we can write a procedure.
  111.  
  112.          Procedures
  113.  
  114.          These can be thought of as short programs. To write a
  115.          procedure to draw a square type:
  116.          TO Square and press return.
  117.          The prompt has changed from a ? to a > showing you that
  118.          you are in the editor and not controlling the Turtle.
  119.          Enter the lines :
  120.          REP 4[FD 100 RT 90]
  121.          END
  122.  
  123.          The last line has told the computer that you have finished
  124.          with the editor and you now wish to have control over the
  125.          Turtle again You could have just pressed return rather
  126.          than type the word end.
  127.  
  128.          This time to draw that square all you have to do is to
  129.          type Square and the Turtle will carry out the procedure
  130.          Square.
  131.  
  132.          We can demonstrate this with:
  133.          CS REP 18[Square RT 20 FD 40]
  134.  
  135.          You could have called it any name you wanted to but square
  136.          seems sensible.
  137.  
  138.          It is possible to make further improvements to this
  139.          procedure. This time enter:
  140.  
  141.          TO Sqsz :Size
  142.          REP 4 [FD :Size RT 90]
  143.          END
  144.  
  145.          To get this procedure to work you will have to give the
  146.          variable Size a value. We do this when we call the
  147.          procedure Sqsz by entering:
  148.          CS Sqsz 200
  149.  
  150.          This puts the value 200 into the variable Size and then
  151.          draws a square of size 200.
  152.  
  153.          Try the following:
  154.          CS
  155.          MAKE "Size 10
  156.          REP 20 [Sqsz :Size MAKE "Size :Size+20]
  157.  
  158.          Pretty isn't it?
  159.  
  160.          The Logo Commands
  161.  
  162.          PR is the command to print. It is introduced first of all
  163.          because it is used in so many of the following examples. It
  164.          can be entered in its full form as PRINT.
  165.  
  166.          ABS       As in PR ABS -3 gives the absolute value of the
  167.          input number.  In this case it will output 3.
  168.  
  169.          AND       As in PR AND 3<4 7>4 prints TRUE if both
  170.          conditions are true.
  171.  
  172.          ARC       As in ARC 0 0 100 180 270 draws an arc at
  173.          position 0,0 of radius 100 units from  heading 180 to 270.
  174.          If negative numbers are use for the start and finish then
  175.          the arc is drawn as a slice of pie.
  176.          eg ARC 0 0 100 -180 -270
  177.  
  178.          ASCII     As in PR ASCII "A prints the ASCII value of the
  179.          first letter. In this case it will be 65.
  180.  
  181.          ATN  As in PR ATN 2 outputs the arctangent (inverse of
  182.          tangent) in degrees. In this case it prints the angle that
  183.          has a tangent of 2.
  184.  
  185.          BACK or BK As in BACK 100. Moves the Turtle back 100 units.
  186.  
  187.          BYE       Leaves the current session of Logo.
  188.  
  189.          CHAR      As in PR CHAR 82 prints the letter corresponding
  190.          to ASCII code 82.
  191.  
  192.          CIRCLE    As in CIRCLE 0 0 100 draws a circle of radius 100
  193.          and centre at 0,0 -the centre of the screen. It does not
  194.          move the Turtle. eg
  195.          MAKE "R 10
  196.          REPEAT 20[CIRCLE :r*~1 :r*~1 :r MAKE "r :r+10]
  197.          Note that unary negative is ~ not - as in ~2 for minus 2.
  198.  
  199.          CLEAN     Erases the contents of the viewport but without
  200.          affecting the Turtle.
  201.  
  202.          COS       As in PR COS 20 outputs the cosine of the angle
  203.          (which is entered in degrees).
  204.  
  205.          CS        This is short for clear screen. It erases the
  206.          contents of the viewport and places the Turtle at 0,0 and
  207.          on a heading of 0.
  208.  
  209.          CT        This is short for clear text. Erases the contents
  210.          of the text window and places the cursor in the top left
  211.          hand corner.
  212.  
  213.          DEGREES   As in PR DEGREES 25 prints out the number of
  214.          degrees in the entered number of radians.
  215.  
  216.          DIR       As in DIR  outputs all the files with a .LOG
  217.          suffix in the current drive and directory.
  218.  
  219.          DOT       As in DOT 50 50 which places a dot at 50,50
  220.          without moving the Turtle. PE followed by DOT will erase a
  221.          point.
  222.  
  223.          EDALL     Loads all the procedures and variables in the
  224.          workspace into the text editor. To leave the editor use
  225.          the ESCape key.
  226.  
  227.          EDIT or ED As in ED "Pat loads the specified procedure into
  228.          the text editor.
  229.  
  230.          END Indicates the end of a procedure.
  231.  
  232.          ERALL Erases all the procedures and variables from the
  233.          workspace.
  234.  
  235.          FENCE     Limits the Turtle to the screen. It also warns
  236.          you if the Turtle is out of bounds.
  237.  
  238.          FILL      As in FILL 3. Fills the area around the Turtle
  239.          with colour 3.
  240.  
  241.          FORWARD or FD As in FORWARD 100 moves the Turtle forward by
  242.          100 units.
  243.  
  244.          HEADING   As in PR HEADING prints out the Turtle's heading.
  245.  
  246.          HOME      Returns the Turtle to the Home position of 0,0
  247.          and with heading 0(North).
  248.  
  249.          HT        This is short for hide Turtle. It makes the
  250.          Turtle invisible and speeds up drawing.
  251.  
  252.          IF        As in
  253.               IF :A>:B [PR [:A is bigger]] [PR [:A is not bigger]]
  254.          If the condition is true the first command is carried out.
  255.          If not true the second command is carried out if it is
  256.          present.  The conditional statement can contain <, > or =
  257.          but not combinations of them.
  258.  
  259.          INT       As in PR INT 3.34 which prints the integer
  260.          portion of 3.34 which is 3.
  261.  
  262.          LEFT or LT As in LT 90 which turns the Turtle 90 to the
  263.          left. All angles are in degrees.
  264.  
  265.          LOAD      As in LOAD "Mine which loads the procedures and
  266.          variables in Mine into the workspace.
  267.  
  268.          LN        As in PR LN 2 which prints the natural log of the
  269.          number.
  270.  
  271.          MAKE      As in MAKE "Side 50 which places 50 into the
  272.          variable Side. This is now a global variable. The following
  273.          are correct syntax:
  274.          MAKE "A SIN(34)
  275.          Make "A LN(34.5)
  276.          Note that calculations should not contain spaces.
  277.  
  278.          NOT       As in PR NOT(3=4) which prints True since the
  279.          expression is false.
  280.  
  281.          OR        As in PR OR (1=2) (1=1) which prints True since
  282.          the one of the two conditions is true.
  283.  
  284.          PENDOWN or PD Puts the Turtle pen down to resume drawing
  285.          after a PE or PU command.
  286.  
  287.          PENERASE or PE Makes the Turtle pen into an eraser by
  288.          making it draw in the background colour.
  289.  
  290.          PENUP or PU Picks the Turtle pen up so that the Turtle can
  291.          be moved without affecting the drawing. Try
  292.          REP 4[ REP 10 [FD 20 PU FD 20 PD] RT 90]
  293.  
  294.          POS       As in PR POS prints the position of the Turtle.
  295.  
  296.          PRINT or PR As in PR "Me prints Me.
  297.  
  298.          PROD      As in PR PROD 2 3 or PR PROD 2 3 4 which prints
  299.          the product of the numbers which follow.
  300.  
  301.          QUOT      As in PR QUOT 24 7 which outputs the integer part
  302.          of the division. In this case 3.
  303.  
  304.          RADIANS   As in PR RADIANS 90 which will output the number
  305.          of radians which was entered as degrees.
  306.  
  307.          RANDOM    As in PR RANDOM 20 which prints out a random
  308.          number between 1 and 20.
  309.  
  310.          REMAINDER As in PR REMAINDER 7 3 which prints out the
  311.          remainder of 7 divided by 3.
  312.  
  313.          REPEAT or REP As in REP 4[ FD 100 RT 90] which repeats the
  314.          instructions in the square brackets 4 times.
  315.  
  316.          RIGHT or RT As in RT 90 which turns the Turtle right by 90
  317.          degrees.
  318.  
  319.          ROUND     As in PR ROUND 3.5 which rounds the input number
  320.          to the nearest integer- in this case 4.
  321.  
  322.          SAVE      As in SAVE "Mine which will save all the
  323.          procedures and variables to the file Mine. It is possible
  324.          to put a path before it to save it to a different disc or
  325.          drive.
  326.  
  327.          SETBG     As in SETBG 2 followed by CS which will then set
  328.          the background to the new colour.
  329.  
  330.          SETH      As in SETH 45 which sets the Turtle heading to 45
  331.          degrees.
  332.  
  333.          SETPC     As in SETPC 3 which sets the pencolour to colour
  334.          3.
  335.  
  336.          SETPOS    As in SETPOS 50 50  which puts the Turtle at co-
  337.          ordinates 50,50
  338.  
  339.          SETX      As in SETX 100 moves the Turtle horizontally to X
  340.          co-ordinate 100.
  341.  
  342.          SETY      As in SETY 100 moves the Turtle vertically to Y
  343.          co-ordinate 100.
  344.  
  345.          SHOWTURTLE or ST Makes the Turtle visible if it has been
  346.          hidden with HT.
  347.  
  348.          SIN       As in PR SIN 30 which outputs the sine of the
  349.          angle which was input in degrees.
  350.  
  351.          SQRT      As in PR SQRT 64 which will print out the square
  352.          root of 64 being 8.
  353.  
  354.          SUM       As in PR SUM 2 2 which will print out the sum of
  355.          the numbers which follow.
  356.  
  357.          TAN       As in PR TAN 45 which will print out the Tangent
  358.          of 45 degrees.
  359.  
  360.          TO        As in TO Sq being the first line of the procedure
  361.          called Sq.
  362.  
  363.          TOWARDS   As in PR TOWARDS 50 75 which will print the
  364.          heading for the Turtle to move towards co-ordinates 50,75.
  365.  
  366.          WINDOW    Allows the Turtle to move anywhere but if it
  367.          leaves the screen area it will not be visible.
  368.  
  369.          WRAP      Allows the Turtle to treat the screen as a
  370.          sphere. When it disappears from one side it will reappear
  371.          on the opposite side of the screen.
  372.  
  373.          XCOR      As in PR XCOR will print the X co-ordinate of the
  374.          Turtle
  375.  
  376.          YCOR      As in PR YCOR will print the Y co-ordinate of the
  377.          Turtle.
  378.